<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Z-BLOG | <%= title %>
    </title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
        integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous" />
    <link rel="stylesheet" href="/css/main.css" />
</head>

<body>
    <div class="alert-wrap ">
        <% alertSuccess.forEach(item=> { %>
            <div class="alert alert-success alert-dismissible mb-0" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <%= item %>
            </div>
            <%}); %>

                <% alertError.forEach(item=> { %>
                    <div class="alert alert-danger alert-dismissible mb-0" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <%= item %>
                    </div>
                    <%}); %>
    </div>
    <!-- 顶部导航栏 -->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand pr-0 pt-10" href="/">
                    <img src="/img/logo.png" alt="" height="30" />
                </a>
            </div>

            <!-- collapse -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <form class="navbar-form navbar-left form-inline" action="">
                    <div class="form-group">
                        <div class="input-group">
                            <input type="text" class="form-control br-tl-30 br-bl-30" id="exampleInputAmount"
                                placeholder="搜索文章、博主" />
                            <div class="
                    input-group-addon
                    bg-color-primary
                    bd-color-primary
                    br-br-30 br-tr-30
                    pd-0
                    color-white
                    overflow-hidden
                  ">
                                <button type="submit" value="GO" class="btn search-submit outline-none color-white">
                                    GO
                                </button>
                            </div>
                        </div>
                    </div>
                </form>

                <ul class="nav navbar-nav navbar-right">
                    <% if(!authUser) {%>
                        <li><a href="login">登录</a></li>
                        <li>
                            <a href="register" class="
                                btn btn-default
                                navbar-btn
                                mr-10
                                br-30
                                pt-6
                                pb-6
                                outline-none
                                ">
                                注册
                            </a>
                        </li>
                        <%} else {%>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                    aria-haspopup="true" aria-expanded="false">
                                    <%= authUser.username %>
                                        <span class="caret"></span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a href="/user/<%= authUser._id %>/edit">修改个人资料</a>
                                    </li>
                                    <li>
                                        <a href="/user/<%= authUser._id %>">个人空间</a>
                                    </li>
                                    <li role="separator" class="divider"></li>
                                    <li>
                                        <a href="/logout">退出网站</a>
                                    </li>
                                </ul>
                            </li>
                            <% } %>
                                <li>
                                    <a href="/post/WriteArticles" class="
                                btn btn-primary
                                navbar-btn
                                br-30
                                pt-6
                                pb-6
                                bg-color-primary
                                bd-color-primary
                                outline-none
                                color-white
                            ">
                                        <i class="glyphicon glyphicon-pencil mr-10"></i>写文章
                                    </a>
                                </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
    <!-- 顶部导航栏结束 -->